package com.wqr.consumer;

import com.wqr.api.pojo.User;
import com.wqr.api.service.IUserService;
import org.apache.dubbo.config.annotation.Reference;
import org.springframework.boot.CommandLineRunner;
import org.springframework.stereotype.Component;

/**
 * @author LTX
 */
//@Component
public class Consumer implements CommandLineRunner {

///    同一台机器运行provider和consumer，需要禁止单播改为广播，添加parameters = {"unicast", "false"}
    @Reference(version = "1.0.0", parameters = {"unicast", "false"})
    private IUserService userService;

    @Override
    public void run(String... args) throws Exception {
        User user = userService.selectUserById(2);
        System.out.println(user);
    }
}
